<template>
	<view class="page">  
		<web-view class="webview" :src="url" :webview-styles="webviewStyles" :update-title="false"></web-view>
		<view v-if="type==1" class="footer">
			<navigator url="/pages/qianzi/qianzi" hover-class="none" class="fix-wrap created-btn-wrap">
				<view class="btn submit-btn">签名</view> 
			</navigator>
		</view>
	</view>
</template>

<script>
	// import pdf_img from '@/plugins/pdfToImg/pdtToImg.js'
	export default {
		name: 'demo',
		data() {
			return {
				type:'',
				url:'', 
				webviewStyles:{
					height:'85%'
				}
			}
		},
		async onShow() { 
		},
		async onLoad(params) { 
			this.type=params.type;
			this.webviewStyles.height=this.type==1?'85%':'100%';
			let fileUrl='';
			fileUrl = encodeURIComponent(`https://xmjz.pher.cn:1443/api/file/viewfilecom?name=广州瑞丰生物科技有限公司员工手册&type=1`) // encodeURIComponent 函数可把字符串作为 URI 组件进行编码。
			// pdf 类型
			if(plus.os.name === 'Android') {
				this.url=`/hybrid/html/web/viewer.html?file=${fileUrl}`;
			}else {
				// ios，直接访问pdf所在路径
				this.url = encodeURIComponent(fileUrl);
			}				
			
			 
			// pdf_img()
			 
			// this.urlList = pdf_img('data:application/pdf;base64,' + res.data.pdf_base64,'pdf','base64');		
		},
		methods: {
			 
		},
		computed: {

		},
		components: {

		},
		onUnload() {
			 
		},
	}
</script>

<style lang="less" scoped> 
.webview{ 
}
	.created-btn-wrap{
		display: flex;
		.btn{
			height: 80rpx;
			line-height: 80rpx;
			margin: 10rpx 10rpx 0;
			flex-grow: 1;
			border-radius: 8rpx;
			text-align: center;
			font-size: 30rpx;
			color:#fff;
		}
		.next-btn{
			background: #ff9600; 
		}
		.submit-btn{
			background: #0099ff; 
		}
	} 
	 
</style>
